package common {
	import flash.display.Graphics;
	
	public class FMath {
		public static function drawArc(graphics:Graphics, centerX:Number, centerY:Number, radius:Number, startAngle:Number, arcAngle:Number, steps:int, flip:Boolean = false):void {
			var twoPi:Number = 2 * Math.PI;
			var angleStep:Number = arcAngle / steps;
			
			var xx:Number = centerX + Math.cos(startAngle * twoPi) * radius;
			var yy:Number = centerY + Math.sin(startAngle * twoPi) * radius;
			if (flip)
				xx = -xx;
			graphics.moveTo(xx, yy);
			
			for (var i:int = 1; i <= steps; i ++) {
				var angle:Number = startAngle + i * angleStep;
				
				xx = centerX + Math.cos(angle * twoPi) * radius;
				yy = centerY + Math.sin(angle * twoPi) * radius;
				if (flip)
					xx = -xx;
				
				graphics.lineTo(xx, yy);
			}
		}
		
		public static function get randColor():uint {
			return Math.random() * uint.MAX_VALUE;
		}
		
		public static function pickRand(...args):* {
			var index:int = Math.random() * args.length;
			return args[index];
		}
	}
}
